package com.zoe.spring.controller.superadmin;

import com.zoe.spring.entity.bo.HeadLine;
import com.zoe.spring.entity.dto.Result;
import com.zoe.spring.service.solo.HeadLineService;
import org.zoeframework.core.annotation.Controller;
import org.zoeframework.core.inject.annotation.Autowire;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author Zoe.Zhang
 * @date 2022/01/12
 * @description
 */
@Controller
public class HeadLineOperationController {
    @Autowire
    private HeadLineService headLineService;

    public Result<Boolean> addHeadLine(HttpServletRequest req, HttpServletResponse resp) {
        return headLineService.addHeadLine(new HeadLine());
    }

    public Result<Boolean> delHeadLine(HttpServletRequest req, HttpServletResponse resp) {
        return headLineService.delHeadLine(1);
    }

    public Result<Boolean> updateHeadLine(HttpServletRequest req, HttpServletResponse resp) {
        return headLineService.updateHeadLine(new HeadLine());
    }

    public Result<HeadLine> getHeadLineById(HttpServletRequest req, HttpServletResponse resp) {
        return headLineService.getHeadLineById(1);
    }

    public Result<List<HeadLine>> listHeadLines(HttpServletRequest req, HttpServletResponse resp) {
        return headLineService.listHeadLines(new HeadLine(), 1, 5);
    }
}
